﻿@model FreeDAM.Domain.Entities.Asset
@{
    ViewBag.Title = "View";
}

@if (Model.MimeType.StartsWith("video", StringComparison.InvariantCultureIgnoreCase))
{
    <video width="600" height="400" controls="controls" preload="metadata">
        @*@{
            FreeDAM.Domain.Entities.Rendition rendition = Model.Renditions.SingleOrDefault(r => r.FileName.EndsWith("mp4"));
            <source type="@rendition.MimeType" src="@Url.Content(rendition.ServerRelativePath)" />
        }*@
                        
        @*<source type="@rendition.MimeType" src="@Url.Content(rendition.ServerRelativePath)" />*@
        @foreach (FreeDAM.Domain.Entities.Rendition rendition in Model.Renditions)
        {
            if (rendition.MimeType.Contains("video"))
            {
                <source type="@rendition.MimeType" src="@Url.Action("DisplayRendition", "Files", new { id = rendition.Id })" />
            }
        }
    </video>
}